home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-01
/
cexpert.zip
/
MCH12.LST
< prev
next >
Wrap
File List
|
1990-09-15
|
37KB
|
985 lines
Listing 12-1 Sample Program foe the Inventory Control System
Prototype Using IQ-200
#| **********************************************************************
Inventory Control Demo INTERFACE
********************************************************************** |#
(define-interface 'inventory-control
:banner " Inventory Control System Demonstration "
:hot-keys '((224 (start-help)) (238 (quit-interface)) ; f1 and f2
(#\c-d (dos)) (#\c-r (redraw-screen)) (#\c-m (mouse-initialize)))
:hot-keys-doc " F1: Help F10: Quit C-D: Dos C-R: Redraw C-M: Init Mouse "
:help-file-pathname "c:\\iq200\\examples\\icshelp.txt")
;;;_________________________MODES
(define-mode 'inventory-control 'toplevel-mode " Inventory Toplevel "
'(("Dealership" (run-mode 'dealership-operations-mode))
("Warehouse" (run-mode 'warehouse-operations-mode))
("System" (run-mode 'system-operations-mode))
("Help" (start-help 'toplevel-mode))
("Quit" (quit-interface))))
(define-mode 'inventory-control 'Dealership-Operations-Mode " Dealers "
'(("Inventory" (view-dealer-inventory) :doc "Inventory of a dealer")
("Purchase" (request-sale) :doc "Purchase an item")
("Order" (order-part) :doc "Enter order from warehouse")
("Show Outstanding" (view-outstanding-orders)
:doc "Show outstanding orders")
("Show Processed" (view-processed-orders) :doc "Show processed orders")
("Check-Dealers" (check-dealers) :doc "Check dealers for part")))
(define-mode 'inventory-control 'warehouse-Operations-Mode " Warehouses "
'(("View Inventory" (view-warehouse-inventory) :doc "View entire inventory")
("Price" (Get-Price) :doc "Get discounted price of part")
("Process Orders" (process-orders) :doc "Process Outstanding Orders")
("Low Inventories" (check-low-inventories) :doc "Check Low Inventories")
("Sales Percentage" (sales-percentage) :doc "Part % of total sales")))
(define-mode 'inventory-control 'system-operations-mode " System "
'(("Redraw" (redraw-screen) :doc "Redraw the screen")
("Go to DOS" (dos))))
;;;__________________________DEALER PROCEDURES
;;;DEALER INVENTORY
(defprocedure view-dealer-inventory
(deactivate-rule-set 'basic-rule-set)
(activate-rule-set 'userint-rules)
(activate-rule-set 'd-inv-rules)
(query '(show-dealer-inventory))
(user-pause))
;;;PURCHASE
(defprocedure request-sale
(deactivate-rule-set 'basic-rule-set)
(activate-rule-set 'userint-rules)
(activate-rule-set 'request-rules)
(query '(request-part))
(user-pause))
;;;ORDER PART
(defprocedure Order-Part
(deactivate-rule-set 'basic-rule-set)
(activate-rule-set 'userint-rules)
(activate-rule-set 'order-rules)
(query '(order-part))
(user-pause))
;;;VIEW CUSTOMER ORDERS
(defprocedure View-Outstanding-Orders
(deactivate-rule-set 'basic-rule-set)
(activate-rule-set 'userint-rules)
(activate-rule-set 'view-outstanding-rules)
(query '(view-orders))
(user-pause))
;;;VIEW PROCESSED ORDERS
(defprocedure View-Processed-Orders
(deactivate-rule-set 'basic-rule-set)
(activate-rule-set 'userint-rules)
(activate-rule-set 'view-processed-rules)
(query '(view-processed-orders))
(user-pause))
;;;CHECK DEALERS
(defprocedure Check-Dealers
(deactivate-rule-set 'basic-rule-set)
(activate-rule-set 'userint-rules)
(activate-rule-set 'request-rules)
(query '(dealer-check))
(user-pause))
;;;____________________________WAREHOUSE PROCEDURES
;;;WAREHOUSE INVENTORYè(defprocedure View-Warehouse-Inventory
(deactivate-rule-set 'basic-rule-set)
(activate-rule-set 'userint-rules)
(activate-rule-set 'w-inv-rules)
(query '(show-warehouse-inventory))
(user-pause))
;;;PRICE
(defprocedure Get-Price
(deactivate-rule-set 'basic-rule-set)
(activate-rule-set 'userint-rules)
(activate-rule-set 'price-rules)
(query '(display-price))
(user-pause))
;;;PROCESS CUSTOMER ORDERS
(defprocedure Process-Orders
(deactivate-rule-set 'basic-rule-set)
(activate-rule-set 'userint-rules)
(activate-rule-set 'process-order-rules)
(stash '(value-of part-found nil))
(query '(process-orders))
(user-pause))
;;;LOW INVENTORIES
(defprocedure Check-Low-Inventories
(deactivate-rule-set 'basic-rule-set)
(activate-rule-set 'userint-rules)
(activate-rule-set 'low-inv-rules)
(stash '(value-of part-found nil))
(query '(identify-critical-inventories))
(user-pause))
;;;SALES PERCENTAGE
(defprocedure Sales-Percentage
(deactivate-rule-set 'basic-rule-set)
(activate-rule-set 'userint-rules)
(activate-rule-set 'percentage-rules)
(stash '(value-of total-sales 0))
(stash '(value-of part-sales 0))
(query '(get-sales-percentage))
(user-pause))
#| **********************************************************************
Baldur Host Setup file.
\'s for the c regexpr parser must be doubled (for lisp)
********************************************************************** |#
(define-host 'baldur :phone-number 7329715 :password 'changeme1
:password2 'changeme2 :os 'dos
:programs '((dbase3 "c:\\dbase\\") (sql "c:\\sqlbase\\"))
:toplevel-program 'baldur-server
:documentation "Hayward AT #1: God of light and Joy (Helios)")
(define-host 'odin :phone-number 7329716 :password 'changeme1
:password2 'changeme2 :os 'dos
:programs '((dbase3 "c:\\dbase\\") (sql "c:\\sqlbase\\"))
:toplevel-program 'baldur-server
:documentation "Hayward AT #2: Lord of the Gods (Zeus)")
(define-host 'thor :phone-number 3276521 :password 'changeme1
:password2 'changeme2 :os 'dos
:programs '((dbase3 "c:\\dbase\\") (sql "c:\\sqlbase\\"))
:toplevel-program 'baldur-server
:documentation "Menlo Park AT #1: The War-God (Ares)")
(define-host 'ymer :phone-number 3253860 :password 'changeme1
:password2 'changeme2 :os 'dos
:programs '((dbase3 "c:\\dbase\\") (sql "c:\\sqlbase\\"))
:toplevel-program 'baldur-server
:documentation "Menlo Park AT #2")
(define-host 'tyr :phone-number 3269106 :password 'changeme1
:password2 'changeme2 :os 'dos
:programs '((dbase3 "c:\\dbase\\") (sql "c:\\sqlbase\\"))
:toplevel-program 'baldur-server
:documentation "Stanford AT #2: The father of the Gods (Kronos)")
(define-host 'loki :phone-number 3234754 :password 'changeme1
:password2 'changeme2 :os 'dos
:programs '((dbase3 "c:\\dbase\\") (sql "c:\\sqlbase\\"))
:toplevel-program 'baldur-server
:documentation "Stanford AT #1: The mischievous God")
#| **********************************************************************
Inventory Control System Demo OBJECTS
This file contains all the objects for use with the ICS Demo.
********************************************************************** |#
;;;_________________________RULE SETS
(create-rule-set 'dealer-rules)
(create-rule-set 'request-rules :superset 'dealer-rules)
(create-rule-set 'order-rules :superset 'dealer-rules)
(create-rule-set 'd-inv-rules :superset 'dealer-rules)
(create-rule-set 'view-outstanding-rules :superset 'dealer-rules)
(create-rule-set 'view-processed-rules :superset 'dealer-rules)
(create-rule-set 'warehouse-rules)
(create-rule-set 'w-inv-rules :superset 'warehouse-rules)
(create-rule-set 'price-rules :superset 'warehouse-rules)
(create-rule-set 'low-inv-rules :superset 'warehouse-rules)è (create-rule-set 'process-order-rules :superset 'warehouse-rules)
(create-rule-set 'percentage-rules :superset 'warehouse-rules)
(create-rule-set 'userint-rules)
;;; **********************************************************************
;;; Rules to determine what parts, dealers, and warehouses exist.
;;; Parts list rules
(create-variable 'parts-list :constraint :list)
(create-rule 'get-parts-list :rule-set 'userint-rules
:premise '(and (format "~%Compiling list of parts...")
(set-of ?name
(entity ?x is-a san-fran-inv
with name = ?name)
?p)
(or (not (equal ?p nil))
(format "no parts found at San-Fran!!")))
:action '(stash '(value-of parts-list ?p))
:conclusion '(get-parts-list ?p))
(create-rule 'Part-List :rule-set 'userint-rules
:premise '(and (cut)
(or (value-of parts-list ?list)
(get-parts-list ?list)))
:conclusion '(get-list :part ?list))
;;; Warehouse & Dealer list rules
(create-rule 'Warehouse-List :rule-set 'userint-rules
:premise '(set-of ?x (entity ?x is-a warehouse) ?list)
:conclusion '(get-list :warehouse ?list))
(create-rule 'Dealer-List :rule-set 'userint-rules
:premise '(set-of ?x (entity ?x is-a dealer) ?list)
:conclusion '(get-list :dealer ?list))
;;;_________________________SPECIAL I/O RULES
;;; Supports types of :dealer :warehouse :part
;;; (achieve '(pick-value "Enter dealer to use" :dealer ?answer))
(create-rule 'pick-value :rule-set 'userint-rules
:premise '(and (get-list ?type ?list)
(cut)
(menu-choose ?list ?string ?result))
:conclusion '(pick-value ?string ?type ?result))
;;;**********************************************************************
;;; DEALERSHIP OPERATION RULES *
;;;**********************************************************************
;;;_________________________DEALER INVENTORY
(create-rule 'display-dealer-inv :rule-set 'd-inv-rules
:premise '(and (pick-value "Enter dealer to use" :dealer ?dealer)
(entity ?dealer is-a dealer with inventory = ?inv)
(entity ?ent is-a ?inv with name = ?part-name
with cil = ?cil)
(format "~%Part-Name: ~A, Number in Stock: ~A"
?part-name ?cil)
(fail))
:conclusion '(show-dealer-inventory))
;;;_________________________REQUEST SALE
(create-rule 'new-request :rule-set 'request-rules
:premise '(and (pick-value "Enter dealer to use" :dealer ?dealer)
(or (and (remote-dealer ?dealer) (cut)
(format "~%Sorry, ~A is a foreign dealer and cannot"
?dealer)
(format "~%accept purchases at this location.")
(fail))
(succeed))
(pick-value "Enter part to use" :part ?part-name)
(menu-input "Enter number desired" :integer ?num)
(format "~%Looking in ~A's inventory for ~A"
?dealer ?part-name)
(request ?dealer ?part-name ?num))
:conclusion '(request-part))
(create-rule 'process-request :rule-set 'request-rules
:premise '(or (and (num-available? ?curr-deal ?part-name ?num)
(format "~%Part ~A is in stock in ~A. Reducing inventory..."
?part-name ?curr-deal)
(reduce-inv ?curr-deal ?part-name ?num))
(format "~%Part ~A not available at ~A.~%Try checking other dealers or ordering part."
?part-name ?curr-deal))
:conclusion '(request ?curr-deal ?part-name ?num))
(create-rule 'remote-dealer :rule-set 'request-rules
:premise '(and (inventory ?dealer ?inv)
(entity ?ks is-a knowledge-source
with class-defined = ?inv))
:conclusion '(remote-dealer ?dealer))
(create-rule 'reduce-inventory :rule-set 'request-rules
:premise '(and (inventory ?curr-deal ?inv)
(entity ?ent is-a ?inv with name = ?part-name
with cil = ?old)
(- ?old ?num ?new)
(format "~%Inventory at ~A reduced from ~A to ~A."
?curr-deal ?old ?new))
:conclusion '(reduce-inv ?curr-deal ?part-name ?num)
:action '(stash '(cil ?ent ?new)))
(create-rule 'Available :rule-set 'request-rules
:premise '(and (inventory ?source ?inv)
(entity ?ent is-a ?inv with name = ?part-name
with cil = ?cil)
(<= ?number ?cil))
:conclusion '(num-available? ?source ?part-name ?number))
;;;_________________________ORDER PART
;;; Top level backward chaining rule.
(create-rule 'order-new-part :rule-set 'order-rules
:premise '(and (pick-value "From which dealer?" :dealer ?curr-deal)
(pick-value "Choose part to order" :part ?part-name)
(choose-values
((num :prompt "Number to order: " :constraint :integer
:mandatory? t)
(cust :prompt "New customer name: " :constraint :name
:mandatory? t)
(date :prompt "Order date: " :constraint :date
:mandatory? t))
"Enter Customer information"
?num ?cust ?date)
(print-arrival-info ?cust ?part-name))
:conclusion '(order-part)
:action '(create-entity '?cust :class 'Stanford-Custs
:name '?cust :dealer '?curr-deal
:part '?part-name :quantity '?num
:order-date '?date))
;;; Gets arrival information from the warehouse.
(create-rule 'calc-days-to-arrival :rule-set 'order-rules
:premise '(and (entity ?ware is-a warehouse)
(format "~%Looking for a warehouse that stocks ~A"
?part-name)
(inventory ?ware ?inv)
(entity ?ent is-a ?inv with name = ?part-name
with order-time = ?days)
(format "~%Warehouse ~A has the part. Computing arrival certainty" ?ware)
(or (adjust-certainty ?part-name) (succeed)))
:conclusion '(days-to-arrival ?part-name ?days)
:certainty 0.9)
(create-rule 'print-arrival-info :rule-set 'order-rules
:premise '(and (certainty-of (days-to-arrival ?part-name ?days) ?cf)
(format "~%The certainty of the order for ~A arriving in ~A days is ~A." ?cust ?days ?cf))
:conclusion '(print-arrival-info ?cust ?part-name))
;;; Adjustment for unreliable part deliveries.
(create-variable 'unreliable-parts :value '(parking_brake cooling_fan)
:constraint :list
:documentation "Parts whose delivery is more uncertain")
(create-rule 'adjust-certainty :rule-set 'order-rules
:premise '(and (value-of unreliable-parts ?up)
(eval (member '?part-name '?up) ?result)
(not (equal ?result nil))
(format "~%Delivery of part ~A found unreliable; adjusting arrival certainty." ?part-name))
:conclusion '(adjust-certainty ?part-name)è :certainty .7)
;;;_________________________VIEW CUSTOMER ORDERS
;;;need OR rule for no order condition
(create-rule 'view-order :rule-set 'view-outstanding-rules
:premise '(and (pick-value "Which dealer's customers?" :dealer ?deal)
(entity ?deal is-a dealer with customers = ?deal-custs)
(entity ?cust-ent is-a ?deal-custs with name = ?n
with part = ?pd)
(entity ?cust-ent is-a ?deal-custs with quantity = ?nd
with order-date = ?od)
(format "~%Customer: ~A, Part: ~A, Quantity: ~A, Ordered: ~A" ?n ?pd ?nd ?od)
(fail))
:conclusion '(view-orders))
;;;_________________________VIEW PROCESSED ORDERS
(create-rule 'view-processed-order :rule-set 'view-processed-rules
:premise '(and (pick-value "Which dealer to view orders from?" :dealer
?dealer)
(or (processed-order ?dealer ?cust ?part-name ?num)
(and (format "~%No orders processed for ~A" ?dealer)
(cut) (fail)))
(format "~%Order Processed for ~A: Cust: ~A, Part: ~A, Number: ~A." ?dealer ?cust ?part-name ?num)
(fail))
:conclusion '(view-processed-orders))
;;;_________________________CHECK DEALERS
(create-rule 'Dealer-Check :rule-set 'request-rules
:premise '(and (pick-value "Enter part to check" :part ?part-name)
(menu-input "Enter number desired" :integer ?num)
(format "~%COMMENCING FOREIGN DEALER INQUIRY...")
(entity ?dealer is-a dealer)
(format "~%~A..." ?dealer)
(or (and (num-available? ?dealer ?part-name ?num)
(format "has ~A ~As in stock" ?num ?part-name))
(format "does not have enough ~As" ?part-name))
(fail))
:conclusion '(dealer-check))
;;;**********************************************************************
;;; WAREHOUSE OPERATION RULES *
;;;**********************************************************************
;;;_________________________WAREHOUSE INVENTORY
(create-rule 'display-warehouse-inventories :rule-set 'w-inv-rules
:premise '(and (pick-value "Choose warehouse to display"
:warehouse ?ware)
(inventory ?ware ?inv)
(entity ?ent is-a ?inv with name = ?part-name
with cost = ?cost with discount = ?discount)
(format "~%Part-Name: ~A, Cost: ~A, Discount: ~A."
?part-name ?cost ?discount)
(fail))
:conclusion '(show-warehouse-inventory))
;;;_________________________GET PRICE
(create-rule 'display-price :rule-set 'price-rules
:premise '(and (pick-value "Enter warehouse to use" :warehouse ?ware)
(pick-value "Pricing for which part?" :part ?part-name)
(format "~%Requesting pricing information from warehouse")
(or (and (inventory ?ware ?inv)
(entity ?ware-ent is-a ?inv with name = ?part-name
with cost = ?cost with discount = ?discount)
(true-cost ?cost ?discount ?true-cost)
(format "~%Current price of ~A (including $~A discount): $~A"
?part-name ?discount ?true-cost))
(format "~%Pricing information on ~A not found."
?part-name)))
:conclusion '(display-price))
(create-rule 'True-Cost :rule-set 'price-rules
:premise '(and (format "~%Evaluating discount costs")
(- ?cost ?discount ?tcost))
:conclusion '(true-cost ?cost ?discount ?tcost))
;;;_________________________PROCESS CUSTOMER ORDERS
;;; this will transfer a part for every customer
(create-rule 'Process-Order :rule-set 'process-order-rules
:premise '(and (pick-value "Enter warehouse to process orders"
:warehouse ?ware)
(subclass ?customer customer)
(entity ?cust is-a ?customer with name = ?name
with part = ?part-name)
(entity ?cust is-a ?customer with dealer = ?dealer
with quantity = ?num)
(format "~%Transfer needed for customer ~A:" ?name)
(format "~% ~A ~A from ~A to ~A"
?num ?part-name ?ware ?dealer)
(transfer ?part-name ?num ?cust ?ware ?dealer)
(eval (stash '(value-of part-found t)))
(fail))
:conclusion '(process-orders))
(create-rule 'notify-no-orders-to-process :rule-set 'process-order-rules
:premise '(and (value-of part-found nil)
(format "~%There are no more current orders."))
:conclusion '(process-orders)
:priority 5)
(create-rule 'transfer-from-ware/delete-cust :rule-set 'process-order-rulesè :premise '(and (inventory ?ware ?ware-inv)
(or (and (entity ?dealer is-a dealer)
(not (remote-dealer ?dealer)))
(and (format "~% Dealer ~A does not exist locally"
?dealer)
(fail)))
(or (entity ?part-inv is-a ?ware-inv with name = ?part-name
with cil = ?cil)
(and (format "~% Could not confirm that warehouse ~A stocks this part"
?ware) (fail)))
(or (and (<= ?num ?cil)
(- ?cil ?num ?new-cil)
(format "~% ~A ~A transfered to ~A for ~A."
?num ?part-name ?dealer ?cust))
(and (format "~% Transfer unsuccessful, insufficient supply at ~A" ?ware)
(fail))))
:conclusion '(transfer ?part-name ?num ?cust ?ware ?dealer)
:action
'(do-all (delete-entity '?cust)
(stash '(and (cil ?part-inv ?new-cil) ; only do this if local!!
(processed-order ?dealer ?cust ?part-name ?num)))))
;;;_________________________LOW INVENTORIES
(create-variable 'part-found :constraint :boolean)
(create-variable 'threshold-inventory :value .25 :constraint :fraction)
(create-rule 'quarter-inv :rule-set 'low-inv-rules
:premise '(and (pick-value "Enter warehouse to use" :warehouse ?ware)
(value-of threshold-inventory ?thres)
(format "~%Parts for warehouse ~A." ?ware)
(inventory ?ware ?inv)
(entity ?ware-ent is-a ?inv with name = ?name
with cil = ?cil with oil = ?oil)
(/ ?cil ?oil ?ratio)
(< ?ratio ?thres)
(* ?ratio 200 ?%ratio)
(eval (stash '(value-of part-found t)))
(format "~%Critical inventory on ~A:" ?name)
(format "~% Current inventory is ~A% of optimal" ?%ratio)
(fail))
:conclusion '(identify-critical-inventories))
(create-rule 'notify-no-low-invs :rule-set 'low-inv-rules
:premise '(and (value-of part-found nil)
(format "~%No parts with critically low inventories."))
:conclusion '(identify-critical-inventories)
:priority 5)
;;;_________________________SALES PERCENTAGE
(create-variable 'total-sales :constraint :number)
(create-variable 'part-sales :constraint :number)
(create-rule 'calc-sales-init :rule-set 'percentage-rulesè :premise '(and (pick-value "Enter warehouse to use" :warehouse ?ware)
(pick-value "Enter part to use" :part ?part-name)
(format "~%Initializing warehouse query for ~A at ~A."
?part-name ?ware)
(get-part-totals ?part-name ?ware)
(calc-sales-perc ?part-name))
:conclusion '(get-sales-percentage))
(create-rule 'calc-stats :rule-set 'percentage-rules
:premise '(or (and (sales-records ?ware ?sr)
(entity ?ent is-a ?sr with total-sale = ?total-sale)
(add-value-to-variable total-sales ?total-sale)
; if the part is the one we want, add its sales
(part ?ent ?part-name)
(add-value-to-variable part-sales ?total-sale)
(fail))
(succeed))
:conclusion '(get-part-totals ?part-name ?ware))
(create-rule 'calc-sales-percentage :rule-set 'percentage-rules
:premise '(and (value-of total-sales ?total-sales)
(value-of part-sales ?part-sales)
(not (= ?total-sales 0))
(eval (* 200 (/ ?part-sales ?total-sales)) ?per)
(format "~%Sales statistics on ~A: " ?part-name)
(format "~%Part Sales = $~A. Total Sales = $~A"
?part-sales ?total-sales)
(format "~%Percentage of Total Sales = ~A%" ?per))
:conclusion '(calc-sales-perc ?part-name))
(create-rule 'notify-part-not-found :rule-set 'percentage-rules
:premise '(format "~%No sales for part requested.")
:conclusion '(get-sales-percentage)
:priority 5)
(create-rule 'add-value-to-variable :rule-set 'percentage-rules
:premise '(and (value-of ?variable ?old)
(+ ?old ?value ?new))
:conclusion '(add-value-to-variable ?variable ?value)
:action '(stash '(value-of ?variable ?new)))
;;;THE END
#| **********************************************************************
Class and Knowledge Source definitions for ICS demo.
**********************************************************************|#
;;; Class definitions for dealer and warehouse inventories on car parts.
(create-class 'Location :documentation "Represents a location"
:slots '((address :constraint :string)
(phone :constraint :number)
(inventory :constraint (:subclass inventory))))
(create-class 'Warehouse :documentation "Represents an actual warehouse"
:superclass 'location
:slots '((sales-records :constraint (:subclass sales-records))))
(create-class 'Dealer :documentation "Represents an actual dealer"
:superclass 'location
:slots '((customers :constraint (:subclass customer))))
(create-class 'Inventory :documentation "Inventory information on a part"
:slots '((name :constraint :name) ; part name
(cil :constraint :integer) ;current invent level
(oil :constraint :integer))) ;optimal invent level
(create-class 'Warehouse-Inv :superclass 'inventory
:documentation "A Warehouse inventory on a part"
:slots '((cost :constraint :number)
(discount :constraint :number)
(min-order :constraint :integer)
(order-time :constraint :integer)))
(create-class 'Dealer-Inv :superclass 'inventory
:documentation "A dealer inventory on a part")
(create-class 'Customer :documentation "Dealership customer"
:slots '((dealer :constraint :name)
(name :constraint :name)
(part :constraint :name)
(quantity :constraint :number :when-needed 1)
(order-date :constraint :date)
(time :constraint :number)))
(create-class 'Sales-Records)
;;; **********************************************************************
;;; Let's create a warehouse
(read-lotus123-class 'San-Fran-Sales-Records
:filename "c:\\iq200\\examples\\ware.wk1"
:superclass 'Sales-Records
:slot-names-row 0
:deleted-rows '(1)
:deleted-columns '(1))
(create-class 'San-Fran-Inv :superclass 'warehouse-inv
:documentation "Inventory of parts for San Francisco Warehouse")
(define-knowledge-source 'San-FranKS :host :local
:program 'dbase3
:filename "c:\\iq200\\examples\\ware.dbf"
:class-defined 'San-Fran-Inv
:slot-with-entity-name nil
:name-constrained-slots '(name)
:slot-name-translations '((min-order min_ord) (order-time order_time)))
#|
(read-dbase3-class 'San-Fran-Inv
:superclass 'warehouse-invè :filename "c:\\iq200\\examples\\ware.dbf"
:slot-with-entity-name nil
:name-constrained-slots '(name)
:slot-name-translations '((min-order min_ord) (order-time order_time)))
|#
(create-warehouse 'San-Fran :inventory 'san-fran-inv :phone 7329715
:address "230 Geary St."
:sales-records 'san-fran-sales-records)
;;; **********************************************************************
;;; Let's create some dealers
;;; Stanford dealer
(read-dbase3-class 'Stanford-Inv
:filename "c:\\iq200\\examples\\dealer1.dbf"
:superclass 'dealer-inv
:documentation "Stanford Inventory")
;;; local customers
(read-dbase3-class 'Stanford-Custs
:filename "c:\\iq200\\examples\\cust1.dbf"
:superclass 'customer
:slot-with-entity-name 'name
:name-constrained-slots '(name dealer part)
:slot-name-translations '((order-date order_date)))
(create-dealer 'stanford :inventory 'stanford-inv :phone 3269106
:customers 'stanford-custs)
;;; Palo Alto dealer
(create-class 'Palo-Alto-Inv :superclass 'dealer-inv)
(define-knowledge-source 'Palo-AltoKS :host :local ; 'odin
:program 'dbase3
:filename "c:\\iq200\\examples\\dealer2.dbf"
:name-constrained-slots '(name)
:class-defined 'Palo-Alto-Inv)
(create-class 'Palo-Alto-Custs :superclass 'customer)
(define-knowledge-source 'Palo-Alto-CustKS :host :local ; 'baldur
:program 'dbase3
:filename "c:\\iq200\\examples\\cust2.dbf"
:slot-with-entity-name 'name
:class-defined 'Palo-Alto-Custs
:name-constrained-slots '(dealer name part)
:slot-name-translations '((order-date order_date)))
(create-dealer 'palo-alto :inventory 'palo-alto-inv :phone 3276521
:customers 'palo-alto-custs)
;;; Hayward Dealer
(create-class 'Hayward-Inv :superclass 'dealer-inv)
(define-knowledge-source 'HaywardKS :host :local
:program 'dbase3
:filename "c:\\iq200\\examples\\dealer3.dbf"
:name-constrained-slots '(name)
:class-defined 'Hayward-Inv)
(create-class 'Hayward-Custs :superclass 'customer)
(define-knowledge-source 'Hayward-custKS :host :local
:program 'dbase3
:filename "c:\\iq200\\examples\\cust3.dbf"
:slot-with-entity-name 'name
:name-constrained-slots '(dealer name part)
:class-defined 'Hayward-Custs
:slot-name-translations '((order-date order_date)))
(create-dealer 'hayward :inventory 'hayward-inv :phone 7329723
:customers 'hayward-custs)
Title:
inventory-control
Text:
Welcome to the Mazda Inventory Control System (ICS). This demo serves
as an introduction to IQ200 - the User Interface, Developers
Interface, and Communications. The main function of the ICS is
to maintain inventories of automobile parts at a number of
dealerships and warehouses.
For assistance with the setup (loading demo files, setting up knowledge
sources, hosts), see subsection SETUP.
Sub-Topics:
(Setup Dealership Warehouse System Help Quit)
Mode:
toplevel-mode
Title:
inventory-control.Setup
Text:
There are 4 files to be loaded before the demo can be used:
ICSINT1.BPL, ICSHOST2.BPL, ICSOBJ3.BPL, and ICSKS4.BPL. The
files can be in any directory. They should be loaded IN THE
ORDER OF THEIR NUMBERS by using the IQ200 interface command Read
(BPL). Otherwise, the file ICS.BPL can be loaded to do the loading
automatically. The KS and HOST files may need to be
edited to proper operation. The HOST file contains all the
functions for setting defining external communications systems -
computer modem lines, operating systems etc. You may want to change
the NAME, PHONE NUMBER, and DBASE DIRECTORY of these hosts to
represent the computers you will be working with. The KS file
contains the descriptions of the sources (files external or
local) you will be using for the dealerships and warehouse.
Currently, all the knowledge sources are set up to use dBASE III
files from the LOCAL computer. For these knowledge sources, you
may wish to change the FILENAME slot to represent the location of
the files. In order to make the knowledge sources remote for
communications demonstration, change the HOST specifications of
the individual knowledge sources (one of Hosts defined in
ICSHOST2). In addition, you may wish to change the DB-FILE and
CLASS-DEFINED to represent the names used for a particular
situation. NOTE: the files ICSINT1 and ICSOBJ3 should never be
changed; neither should any other slots than mentioned above;
neither should any contents of the dbase and lotus files
originally provided.
Title:
inventory-control.Dealership
Text:
The DEALERSHIP commands affect changes in the local dealership,
and gather knowledge from the external dealers and warehouses.
Each dealership maintains a limited selection (both in kind and
quantity) of the parts which are available at the warehouse.
This small inventory is used to satisfy the request of individual
customers at the dealership; if a part is not available (either
in kind or quantity) then the part can be ordered from the
warehouse, or other dealers can be checked for the part.
Sub-Topics:
(Inventory Purchase Order Show-Outstanding Show-Processed Check-Dealers)
Mode:
dealership-operations-mode
Title:
inventory-control.Dealership.Inventory
Text:
The inventory command has one input, the dealership to be used
for the command, and a listed output, the current inventory of
that dealer (part names and number in stock). If the dealer
chosen is an external source, the communications system will
automatically call up the proper host and obtain the information.
Note current inventories at a number of dealers before using
other commands (checking purposes).
Title:
inventory-control.Dealership.Purchase
Text:
Purchase is to discover if a part is available at a dealer in a
certain quantity. Its inputs are: dealer to use, part desired,
and number desired. The output depends on a) if the dealer
selected is local (cannot make purchases from remote dealers);
b) if the part is in stock in the proper quantity at the
dealership requested, the stock at the dealership is reduced and
the user is notified of the sale c) if the part is not in stock,
the user is asked to order the part (use ORDER command) or check
other dealers (CHECK-DEALERS). Note reduction in stock after a
successful sale using the INVENTORY command.
Title:
inventory-control.Dealership.Order
Text:
Order is used to tell the warehouse that a dealership REQUESTS a
new supply of a certain part. It is equivalent to writing a
letter to the warehouse - no reductions in inventory, sales, etc.
will occur upon completion of the procedure. The new order is
considered OUTSTANDING (as opposed to those processed by the
warehouse). Inputs are dealer, part, num desired, order name,
and date. Output is the creation of a customer internal to
Iq200.
Title:
inventory-control.Dealership.Show-Outstanding
Text:
Show-Outstanding merely displays the outstanding (non-processed)
orders at a certain dealer. Name of order, date, part, and
number are displayed. This list will be empty if all orders have
been processed.
Title:
inventory-control.Dealership.Show-Processed
Text:
This command shows all the orders which have been processed by
the warehouse. It will be the empty if their are no orders or
none of the available orders have been processed. Input is the
dealership whose orders you wish to display.
Title:
inventory-control.Dealership.Check-Dealers
Text:
The Check-Dealer command is useful for discovering which DEALERS
have a certain part in stock. This is just a lookup procedure.
The inputs are the part name and the quantity desired, while the
output is a list of all dealers which have the quantity desired
of the part in stock. When using communications, this command
will sequentially call all of the hosts which are serving as
dealers.
Title:
inventory-control.Warehouse
Text:
èThe WAREHOUSE commands operate on either local or non-local
warehouse inventories. Warehouse inventories are much larger
than dealer inventories, both in diversity of parts and in number
available. The warehouse obviously serves as a backup for the
dealers; if no dealership has a certain part, the part can be
ordered by the warehouse. The warehouse also serves two other
functions: the establishment of current pricing information for
all dealerships, and the calculation of sales statistics on
certain parts and groups of parts.
Sub-Topics:
(View-Inventory Price Process-Orders Low-Inventories)
Mode:
warehouse-operations-mode
Title:
inventory-control.Warehouse.View-Inventory
Text:
View-Inventory is a lookup command. It is used to display the
current inventory of the warehouse at any period in time. The
command will request the warehouse to use, and will exit by
displaying a list of all parts and their current prices.
Title:
inventory-control.Warehouse.Price
Text:
PRICE obtains the current price of a part from the warehouse. It
will then attempt to evaluate any discounts on the part and
display the "true" cost of the part. Prices are shown for
quantity of one.
Title:
inventory-control.Warehouse.Process-Orders
Text:
Process-orders is used to satisfy the orders of the dealers by
transferring supplies of parts. For each order which is
outstanding at the dealers, the warehouse will attempt to reduce
its own inventory on the part and send the dealers the correct
quantity of the part. If the correct quantity is not available
at the warehouse, the order cannot be processed, and nothing
happens other than a notice to this effect. If the correct
quantity is available, the warehouse will reduce its own
inventory (note only possible if LOCAL; cant change external),
delete the customer entity, and store information about the
processed order. NOTE: the dealership inventory on the part is
NOT affected - the order is PROCESSED - meaning the order is
ready for pickup by the customer, and can be view using the
dealership SHOW-PROCESSED command.
Title:
inventory-control.Warehouse.Low-Inventories
Text:
Low inventories is a command which attempts to notify the user
about critically low inventories at the warehouse. The procedure
is to sequentially calculate the inventory ratio
(current-inv-level over optimal-inv-level) and display any parts
which are below 0.25. Quarter inventory is therefore the
criteria for low inventory. The command does not attempt to
alleviate any critical inventories.
Title:
inventory-control.System
Text:
System commands are commands for running the demonstration.
Commands are available for redrawing the screen, displaying the
rule structure, and exiting to Dos.
Sub-Topics:
(Redraw Go-To-Dos)
Mode:
system-operations-mode
Title:
inventory-control.System.Redraw
Text:
Redraws the screen. Also available at any time by pressing C-R.
Title:
inventory-control.System.Go-To-Dos
Text:
Exits temporarily to DOS. Type EXIT at the DOS prompt to return
to the demonstration. Quick exit to DOS is also provided by
pressing C-X C-D.
Title:
inventory-control.Help
Text:
Help is available using the Help command, and by pressing the
<F1> function key. Help from the command line is from top-level.
Help from <F1> is context sensitive (depending on the current
mode of operation).
Title:
inventory-control.Quit
Text:
The QUIT command is used to exit the demonstration and return to
IQ200.